/*
 * Created by SharpDevelop.
 * User: David
 * Date: 2006-12-21
 * Time: 23:54
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;

namespace Labb4.Pooman.Misc
{
	/// <summary>
	/// This class takes care of all the input from different sources.
	/// Every member represents some sort of input, and those that are
	/// booleans follow the rule true is pressed, false is not pressed
	/// 
	/// Implements the Singleton design pattern
	/// </summary>
	public sealed class InputManager
	{
		#region members
		
		/// <summary>
		/// The one instance
		/// </summary>
		private static InputManager		m_Instance = new InputManager();
		
		/// <summary>
		/// The status of the button "Play Cards"
		/// </summary>
		private bool					m_PlayCardPressed;
		/// <summary>
		/// The status of the button "Chance"
		/// </summary>
		private bool					m_ChanceCardPressed;
		/// <summary>
		/// The status of the button "Pick up Cards"
		/// </summary>
		private bool					m_PickupCardsPressed;
		
		/// <summary>
		/// The x coordinate of the mouse
		/// </summary>
		private int						m_MouseX;
		/// <summary>
		/// The y coordinate of the mouse
		/// </summary>
		private int						m_MouseY;
		/// <summary>
		/// The status of the left mouse button
		/// </summary>
		private bool					m_MouseClick;
		
		/// <summary>
		/// The status of the menu choice "Open"
		/// </summary>
		private bool					m_FileOpen;
		/// <summary>
		/// The status of the menu choice "Save"
		/// </summary>
		private bool					m_FileSave;
		/// <summary>
		/// The status of the menu choice "New"
		/// </summary>
		private bool					m_FileNew;
		
		/// <summary>
		/// The status of the menu choice "Quit"
		/// </summary>
		private bool					m_Quit;
		
		/// <summary>
		/// The current status string, displayed on the bottom of the screen
		/// </summary>
		private string					m_StatusString;
		/// <summary>
		/// The name of the file to load or save to/from
		/// </summary>
		private string					m_FileName;
		
		#endregion
		
		#region constructors
		
		/// <summary>
		/// Constructor, intializes members
		/// </summary>
		private InputManager()
		{
			m_PlayCardPressed = false;
			m_ChanceCardPressed = false;
			m_PickupCardsPressed = false;
			
			m_MouseX = 0;
			m_MouseY = 0;
			m_MouseClick = false;
			
			m_FileOpen = false;
			m_FileSave = false;
			m_FileNew = false;
			
			m_Quit = false;
			
			m_StatusString = "";
			m_FileName = "";
		}
		
		#endregion
		
		#region properties
		
		/// <summary>
		/// The one instance (get)
		/// </summary>
		public static InputManager Instance
		{
			get
			{
				return m_Instance;
			}
		}
		
		/// <summary>
		/// The status of the button "Play Cards" (set/get)
		/// 
		/// Is always set to false when read, meaning it can only be true once per click
		/// </summary>
		public bool PlayCardPressed
		{
			get
			{
				bool pressed = m_PlayCardPressed;
				m_PlayCardPressed = false;
				return pressed;
			}
			
			set
			{
				m_PlayCardPressed = value;
			}
		}
		
		/// <summary>
		/// The status of the button "Chance" (set/get)
		/// 
		/// Is always set to false when read, meaning it can only be true once per click
		/// </summary>
		public bool ChanceCardPressed
		{
			get
			{
				bool pressed = m_ChanceCardPressed;
				m_ChanceCardPressed = false;
				return pressed;
			}
			
			set
			{
				m_ChanceCardPressed = value;
			}
		}
		
		/// <summary>
		/// The status of the button "Pick up Cards" (set/get)
		/// 
		/// Is always set to false when read, meaning it can only be true once per click
		/// </summary>
		public bool PickupCardsPressed
		{
			get
			{
				bool pressed = m_PickupCardsPressed;
				m_PickupCardsPressed = false;
				return pressed;
			}
			
			set
			{
				m_PickupCardsPressed = value;
			}
		}
		
		/// <summary>
		/// The x coordinate of the mouse (set/get)
		/// </summary>
		public int MouseX
		{
			get
			{
				return m_MouseX;
			}
			
			set
			{
				m_MouseX = value;
			}
		}
		
		/// <summary>
		/// The y coordinate of the mouse (set/get)
		/// </summary>
		public int MouseY
		{
			get
			{
				return m_MouseY;
			}
			
			set
			{
				m_MouseY = value;
			}
		}
		
		/// <summary>
		/// The status of the left mouse button (set/get)
		/// 
		/// Is always set to false when read, meaning it can only be true once per click
		/// </summary>
		public bool MouseClick
		{
			get
			{
				bool click = m_MouseClick;
				m_MouseClick = false;
				return click;
			}
			
			set
			{
				m_MouseClick = value;
			}
		}
		
		/// <summary>
		/// The status of the menu choice "Open" (set/get)
		/// 
		/// Is always set to false when read, meaning it can only be true once per click
		/// </summary>
		public bool FileOpen
		{
			get
			{
				bool open = m_FileOpen;
				m_FileOpen = false;
				return open;
			}
			
			set
			{
				m_FileOpen = value;
			}
		}
		
		/// <summary>
		/// The status of the menu choice "Save" (set/get)
		/// 
		/// Is always set to false when read, meaning it can only be true once per click
		/// </summary>
		public bool FileSave
		{
			get
			{
				bool save = m_FileSave;
				m_FileSave = false;
				return save;
			}
			
			set
			{
				m_FileSave = value;
			}
		}
		
		/// <summary>
		/// The status of the menu choice "New" (set/get)
		/// 
		/// Is always set to false when read, meaning it can only be true once per click
		/// </summary>
		public bool FileNew
		{
			get
			{
				bool fileNew = m_FileNew;
				m_FileNew = false;
				return fileNew;
			}
			
			set
			{
				m_FileNew = value;
			}
		}
		
		/// <summary>
		/// The status of the menu choice "Quit" (set/get)
		/// 
		/// Is always set to false when read, meaning it can only be true once per click
		/// </summary>
		public bool Quit
		{
			get
			{
				bool quit = m_Quit;
				m_Quit = false;
				return quit;
			}
			
			set
			{
				m_Quit = value;
			}
		}
		
		/// <summary>
		/// The current status string, displayed on the bottom of the screen (set/get)
		/// </summary>
		public string StatusString
		{
			get
			{
				return m_StatusString;
			}
			
			set
			{
				m_StatusString = value;
			}
		}
		
		/// <summary>
		/// The name of the file to load or save to/from (set/get)
		/// </summary>
		public string FileName
		{
			get
			{
				return m_FileName;
			}
			
			set
			{
				m_FileName = value;
			}
		}
		
		#endregion
	}
}
